package com.sqx.modules.trendsLike.controller;

import com.sqx.common.utils.Result;
import com.sqx.modules.app.annotation.Login;
import com.sqx.modules.trendsLike.entity.TrendsLike;
import com.sqx.modules.trendsLike.service.ITrendsLikeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 动态点赞-管理端
 *
 * @author wuChang
 * @since 2023-09-27
 */
@RestController
@Api(value = "动态点赞-管理端", tags = {"动态点赞-管理端"})
@RequestMapping("/admin/trendsLike/")
public class AdminTrendsLikeController {
    @Autowired
    private ITrendsLikeService iTrendsLikeService;

    /**
     * 新增或修改动态点赞
     */
    @Login
    @ApiOperation("新增或修改动态点赞")
    @PostMapping(value = "saveTrendsLike")
    public Result saveTrendsLike(@ApiParam("用户id") @RequestAttribute("userId") Long userId,
                                 @ApiParam("动态点赞实体")TrendsLike trendsLike) {
        trendsLike.setUserId(userId);
        return iTrendsLikeService.saveTrendsLike(trendsLike);
    }


    @Login
    @ApiOperation("获取点赞指定用户的列表")
    @GetMapping(value = "getLikeMyList")
    public Result getLikeMyList(@ApiParam("用户id")Long userId,
                                @ApiParam("页码")Integer page,
                                @ApiParam("条数")Integer limit) {
        return Result.success().put("data", iTrendsLikeService.getLikeMyList(userId, page, limit));
    }
}
